<?php

/**
 * Sede form base class.
 *
 * @method Sede getObject() Returns the current form's model object
 *
 * @package    sibi-salud
 * @subpackage form
 * @author     SIBI <sibiud@gmail.com>
 */
abstract class BaseSedeForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'        => new sfWidgetFormInputHidden(),
      'nombre'    => new sfWidgetFormInputText(),
      'telefono'  => new sfWidgetFormInputText(),
      'direccion' => new sfWidgetFormInputText(),
      'gmaps'     => new sfWidgetFormInputText(),
      'mapa'      => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'        => new sfValidatorPropelChoice(array('model' => 'Sede', 'column' => 'id', 'required' => false)),
      'nombre'    => new sfValidatorString(array('max_length' => 45)),
      'telefono'  => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'direccion' => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'gmaps'     => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'mapa'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorAnd(array(
        new sfValidatorPropelUnique(array('model' => 'Sede', 'column' => array('nombre'))),
        new sfValidatorPropelUnique(array('model' => 'Sede', 'column' => array('direccion'))),
        new sfValidatorPropelUnique(array('model' => 'Sede', 'column' => array('gmaps'))),
        new sfValidatorPropelUnique(array('model' => 'Sede', 'column' => array('mapa'))),
      ))
    );

    $this->widgetSchema->setNameFormat('sede[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Sede';
  }


}
